package com.changli06.polymorphism;

public class PersonTest1 {
    public static void main(String[] args) {
        //向下转型
        Person p1 = new Man();
        p1.sleep();
//        无法访问 Man 的属性
//        p1.isSmoking;
        Man m1 = (Man) p1;
        System.out.println(m1.isSmoking);
//        if (p1 instanceof Woman){
//            System.out.println("Woman");
//        }
        if(p1 instanceof Man){
            System.out.println("Man");
        }
    }
}
